package com.shiguiwu.springmybatis.app.service.Impl;

import com.shiguiwu.springmybatis.app.entity.User;
import com.shiguiwu.springmybatis.app.mapper.UserMapper;
import com.shiguiwu.springmybatis.app.service.HelloService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @description:
 * @author: stone
 * @date: Created by 2021/1/28 15:27
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.app.service.Impl
 */
@Service("helloService")
@Slf4j
public class HelloServiceImpl implements HelloService {

    @Autowired
    private UserMapper userMapper;


    @Override
    public void eat(int x) {
        log.info("正在访问v0：{}", x);
    }


    @Transactional
    public boolean addUser() {
        User user = new User();
        user.setUsername("shiguieueeeeeeeeeeeee");
        user.setPhone("18676894410");
        user.setGender("1");
        int insert = userMapper.insert(user);
        ex1();
        return insert > 0;
    }

    @Override
    public void in() {
        long l = System.currentTimeMillis();
        userMapper.inList(list1);
        log.info("耗时时间 ===> {}", (System.currentTimeMillis() - l));

    }


    public void ex1() {
        throw new RuntimeException("haha");

    }

    public static List<Integer> list1 = Arrays.asList(
            3745,
            649,
            4340,
            3100,
            2230,
            1018,
            4610,
            3091,
            141,
            366,
            3909,
            3368,
            2539,
            956,
            3839,
            2046,
            3507,
            1388,
            1276,
            3086,
            2795,
            2574,
            1450,
            3706,
            4158,
            1857,
            252,
            3172,
            1071,
            119,
            3905,
            608,
            421,
            1633,
            1091,
            4341,
            4057,
            752,
            2105,
            1837,
            2629,
            1246,
            1817,
            1262,
            1640,
            2971,
            3744,
            3235,
            154,
            4536,
            2753,
            2356,
            243,
            2251,
            1564,
            954,
            1459,
            3352,
            2207,
            3699,
            4457,
            4593,
            676,
            3337,
            603,
            497,
            1097,
            1140,
            3755,
            494,
            426,
            2916,
            1600,
            3531,
            3458,
            2897,
            1660,
            1253,
            3426,
            2189,
            4585,
            2174,
            2450,
            3494,
            3712,
            4208,
            3679,
            2459,
            216,
            1327,
            3552,
            1359,
            1333,
            3939,
            2943,
            1460,
            764,
            1604,
            3255,
            4116,
            1801,
            1752,
            4491,
            2412,
            2511,
            301,
            352,
            1133,
            2101,
            275,
            967,
            2262,
            502,
            1453,
            4254,
            1488,
            1045,
            3630,
            4655,
            1435,
            2827,
            4621,
            4280,
            3492,
            1153,
            3751,
            1194,
            4183,
            3466,
            4028,
            3687,
            3681,
            2513,
            2065,
            1202,
            881,
            4684,
            3964,
            3012,
            3955,
            668,
            2337,
            2390,
            1218,
            375,
            3526,
            4620,
            2331,
            2937,
            1032,
            4543,
            3622,
            3375,
            209,
            3803,
            4165,
            4618,
            3246,
            3093,
            746,
            4166,
            2533,
            3900,
            245,
            400,
            285,
            3590,
            845,
            1999,
            2877,
            3471,
            2746,
            1759,
            3068,
            170,
            3162,
            4466,
            4329,
            522,
            2898,
            4018,
            110,
            1405,
            962,
            1858,
            2385,
            654,
            2705,
            2411,
            2188,
            3685,
            1201,
            911,
            3304,
            4300,
            2550,
            2794,
            1861,
            1554,
            685,
            2559,
            148,
            2718,
            1653,
            4229,
            3548,
            1480,
            4112,
            4161,
            2744,
            4419,
            4573,
            4370,
            3736,
            4648,
            3923,
            560,
            4597,
            1899,
            548,
            2195,
            1338,
            2297,
            1676,
            2094,
            4691,
            3599,
            2719,
            2474,
            3532,
            3844,
            1623,
            2430,
            2066,
            143,
            3994,
            230,
            3666,
            4197,
            4264,
            3731,
            2945,
            3547,
            1920,
            1269,
            3936,
            4045,
            4641,
            2062,
            1050,
            4444,
            2872,
            1882,
            4135,
            3653,
            667,
            1238,
            828,
            3974,
            1181,
            3523,
            184,
            3266,
            1334,
            474,
            327,
            726,
            2089,
            993,
            1489,
            3903,
            1835,
            3895,
            215,
            4298,
            2859,
            4271,
            2141,
            1228,
            3724,
            3970,
            1314,
            537,
            4093,
            3918,
            2231,
            2358,
            4219,
            1534,
            199,
            2351,
            1384,
            751,
            2894,
            3359,
            3474,
            1856,
            1465,
            1666,
            2964,
            488,
            3315,
            3089,
            4581,
            409,
            4199,
            3722,
            2347,
            3247,
            152,
            1377,
            4527,
            536,
            2361,
            3546,
            859,
            830,
            3355,
            4376,
            3101,
            4682,
            2027,
            1065,
            1961,
            568,
            4312,
            885,
            3450,
            992,
            3149,
            2756,
            2981,
            1717,
            3384,
            2458,
            671,
            207,
            3168,
            2587,
            1802,
            690,
            2307,
            1040,
            1178,
            3792,
            4253,
            1589,
            3018,
            2448,
            3367,
            4071,
            345,
            925,
            1288,
            4445,
            4358,
            2052,
            2381,
            2271,
            3560,
            684,
            2570,
            446,
            4407,
            1828,
            2814,
            4569,
            591,
            1910,
            2733,
            4506,
            1524,
            4178,
            526,
            2966,
            594,
            1317,
            3346,
            2871,
            115,
            66,
            3500,
            4122,
            2480,
            3151,
            99,
            351,
            3035,
            598,
            3556,
            4062,
            2483,
            246,
            3894,
            3124,
            428,
            1614,
            2940,
            1469,
            4422,
            135,
            2131,
            615,
            228,
            2998,
            2577,
            4040,
            2196,
            773,
            1434,
            3074,
            1449,
            3561,
            4430,
            1429,
            2933,
            4681,
            2909,
            1185,
            4410,
            168,
            1379,
            4468,
            3167,
            4403,
            2338,
            4651,
            118,
            3788,
            2674,
            1069,
            2376,
            3105,
            1525,
            986,
            303,
            4666,
            3001,
            2048,
            2935,
            1518,
            3723,
            552,
            4547,
            3818,
            2762,
            3937,
            1282,
            4104,
            805,
            2392,
            4690,
            3893,
            4480,
            4580,
            1026,
            1048,
            3487,
            1104,
            462,
            144,
            4248,
            2217,
            302,
            1751,
            2428,
            2717,
            4460,
            2538,
            329,
            4553,
            1832,
            4041,
            260,
            1553,
            4378,
            2781,
            4507,
            535,
            3877,
            3797,
            1891,
            1755,
            4130,
            3499,
            2666,
            3614,
            4115,
            2465,
            3960,
            3186,
            2306,
            2342,
            3447,
            4160,
            4669,
            2021,
            1773,
            124,
            2312,
            1874,
            817,
            4433,
            2032,
            4626,
            1839,
            3180,
            528,
            889,
            533,
            420,
            3838,
            3038,
            701,
            1118,
            1150,
            1826,
            4390,
            1974,
            204,
            3832,
            1172,
            1851,
            2883,
            4687,
            1909,
            4546,
            3835,
            3055,
            3978,
            998,
            3871,
            1188,
            4606,
            2016,
            4588,
            906,
            3416,
            1398,
            572,
            3899,
            2061,
            2216,
            2111,
            1167,
            2370,
            313,
            4674,
            3214,
            4026,
            1259,
            482,
            2541,
            2982,
            3022,
            1981,
            4521,
            851,
            4324,
            3662,
            2919,
            2283,
            4121,
            1458,
            2096,
            4604,
            3779,
            4334,
            250,
            1073,
            607,
            3430,
            1606,
            4668,
            2778,
            128,
            3718,
            1673,
            675,
            2129,
            2882,
            698,
            3451,
            3639,
            4456,
            640,
            3921,
            257,
            4672,
            3864,
            2298,
            3399,
            1082,
            4223,
            1162,
            1925,
            3364,
            3829,
            4617,
            3257,
            2190,
            4629,
            3551,
            2087,
            945,
            3436,
            2649,
            1305,
            621,
            4032,
            2100,
            4140,
            3735,
            4438,
            4262,
            4541,
            2028,
            2253,
            1731,
            3623,
            3004,
            4473,
            1156,
            602,
            3464,
            2446,
            1902,
            2451,
            893,
            101,
            3206,
            950,
            314,
            3106,
            2776,
            1678,
            2481,
            3624,
            3879,
            2463,
            1322,
            1908,
            1796,
            2854,
            4544,
            2395,
            3065,
            4186,
            397,
            658,
            883,
            977,
            4412,
            2321,
            103,
            2277,
            3342,
            3621,
            4265,
            2798,
            2479,
            647,
            331,
            2552,
            4100,
            2605,
            2768,
            3154,
            989,
            661,
            3195,
            4106,
            4302,
            1462,
            1243,
            868,
            1371,
            1114,
            3147,
            636,
            2081,
            2834,
            3391,
            1279,
            1639,
            1164,
            443,
            2437,
            3634,
            4236,
            2588,
            3011,
            125,
            3232,
            809,
            4603,
            1143,
            1723,
            2405,
            3390,
            2977,
            4640,
            955,
            1990,
            3814,
            1468,
            1003,
            4609,
            4293,
            470,
            2490,
            2586,
            2890,
            3796,
            1083,
            3616,
            2439,
            2301,
            2840,
            2202,
            2460,
            438,
            3125,
            2501,
            506,
            1390,
            4050,
            4388,
            2841,
            2861,
            1590,
            4348,
            2466,
            1208,
            1362,
            3798,
            1414,
            1336,
            279,
            2791,
            1521,
            2433,
            3913,
            3743,
            1641,
            1625,
            2134,
            626,
            4625,
            4090,
            2155,
            2103,
            2417,
            4031,
            3910,
            2080,
            4124,
            790,
            2953,
            1905,
            2454,
            3594,
            2364,
            2914,
            435,
            1642,
            1719,
            4001,
            423,
            1886,
            3061,
            4120,
            905,
            1966,
            2745,
            2578,
            4048,
            3949,
            3170,
            1644,
            3250,
            1227,
            1914,
            1030,
            4524,
            297,
            4179,
            4078,
            1287,
            3482,
            2396,
            4501,
            587,
            2487,
            3228,
            2646,
            3933,
            1570,
            2138,
            1043,
            1433,
            2355,
            1567,
            2886,
            4360,
            801,
            197,
            1271,
            2929,
            1794,
            2332,
            2792,
            4673,
            4058,
            4004,
            1285,
            3617,
            544,
            2969,
            643,
            2625,
            705,
            4355,
            513,
            2727,
            699,
            3360,
            1985,
            2912,
            357,
            4202,
            2928,
            639,
            1697,
            819,
            1629,
            2449,
            2056,
            1254,
            4404,
            898,
            299,
            489,
            2804,
            1738,
            818,
            965,
            4670,
            4661,
            4083,
            1761,
            3453,
            1149,
            1812,
            2097,
            1293,
            1765,
            3433,
            1947,
            3296,
            3789,
            355,
            4474,
            4607,
            50,
            1568,
            3754,
            689,
            3218,
            4313,
            1780,
            4523,
            3029,
            3837,
            160,
            1483,
            244,
            439,
            1088,
            4643,
            1381,
            3840,
            759,
            3984,
            2215,
            2711,
            2989,
            2638,
            3176,
            4299,
            2264,
            4069,
            2007,
            2239,
            2851,
            2520,
            2348,
            622,
            2809,
            791,
            343,
            3787,
            2884,
            837,
            2656,
            1945,
            169,
            4125,
            165,
            2084,
            2157,
            4232,
            1776,
            4023,
            2493,
            4195,
            2562,
            624,
            1353,
            300,
            64,
            3757,
            2117,
            1252,
            2976,
            1402,
            2752,
            3809,
            4526,
            2049,
            2022,
            1756,
            2006,
            517,
            3968,
            4532,
            1095,
            2110,
            2059,
            4574,
            2473,
            4087,
            732,
            2637,
            4601,
            2063,
            1608,
            1959,
            1867,
            1275,
            1424,
            1967,
            3356,
            1674,
            1119,
            1535,
            3822,
            3418,
            4297,
            3421,
            2995,
            748,
            1192,
            270,
            1720,
            227,
            4263,
            4342,
            1274,
            3553,
            1387,
            2086,
            1286,
            155,
            1235,
            1862,
            2317,
            784,
            3303,
            4320,
            3746,
            2565,
            2519,
            3997,
            2367,
            384,
            495,
            3636,
            1086,
            1810,
            4361,
            1316,
            4642,
            713,
            2920,
            3477,
            3979,
            3696,
            2968,
            3661

    ) ;
}
